define(function () {

    var self;
    var infoItem, info;

    function xdcxinfo(){
        self = this;
        self.init();
    }

    //获取 已审核 信息
    xdcxinfo.prototype.getYsh = function () {
        app.ajax({
            xurl:"api/wx/gwat110/getChecked",
            xdata:{
                GWCMDOCNO:infoItem.GWCMDOCNO
            },
            cb:function (data) {

                    if(data.data.data.length > 0){
                        //infoItem.orderDetail.push(data.data.data[0]);
                        app.extend(infoItem.orderList,data.data.data[0])
                    }else {
                        return;
                    }
                    self.getYgw();


            }
        })
    }

    //获取 已购物
    xdcxinfo.prototype.getYgw = function () {
        app.ajax({
            xurl:"api/wx/gwat110/getYgw",
            xdata:{
                GWCODOCNO:infoItem.orderList.GWCODOCNO
            },
            cb:function (data) {

                    if(data.data.data.length > 0){
                        app.extend(infoItem.orderList,data.data.data[0])
                    }else {
                        return;
                    }
                    self.getYxd();


            }
        })
    }

    //已下单
    xdcxinfo.prototype.getYxd = function () {
        app.ajax({
            xurl:"api/wx/gwat110/getYxd",
            xdata:{
                GWCQDOCNO:infoItem.orderList.GWCQDOCNO
            },
            cb:function (data) {

                    if(data.data.data.length > 0){
                        app.extend(infoItem.orderList,data.data.data[0])
                    }else {
                        return;
                    }
                    self.getYfy();


            }
        })
    }

    //已发运
    xdcxinfo.prototype.getYfy = function () {
        app.ajax({
            xurl:"api/wx/gwat110/getYfy",
            xdata:{
                GWCSDOCNO:infoItem.orderList.GWCSDOCNO
            },
            cb:function (data) {

                    if(data.data.data.length > 0){
                        app.extend(infoItem.orderList,data.data.data[0])
                    }else {
                        return;
                    }
                    self.getYaz();


            }
        })
    }

    //已安装
    xdcxinfo.prototype.getYaz= function () {
        app.ajax({
            xurl:"api/wx/gwat110/getYaz",
            xdata:{
                GWCSDOCNO:infoItem.orderList.GWCSDOCNO
            },
            cb:function (data) {

                    if(data.data.data.length > 0){
                        app.extend(infoItem.orderList,data.data.data[0])
                    }else {
                        return;
                    }
                    //return;
                    self.getYpj();


            }
        })
    }

    //已评价
    xdcxinfo.prototype.getYpj= function () {
        app.ajax({
            xurl:"api/wx/gwat110/getYpj",
            xdata:{
                GWCSDOCNO:infoItem.orderList.GWCSDOCNO
            },
            cb:function (data) {

                    if(data.data.data.length > 0){
                        app.extend(infoItem.orderList,data.data.data[0])
                    }else {
                        return;
                    }


            }
        })
    }

    xdcxinfo.prototype.init = function () {
        infoItem = app.cloneJSON(app.pageParameters['xdcxinfo_page']);//获取传的参数
        infoItem.orderList = {
            GWCODOCNO:'',
            GWCWDOCNO:'',
            GWCSDOCNO:'',
            GWCUDOCNO:'',
            GWCVDOCNO:'',
            GWCWDOCNO:'',
            GWCO012:'',
            GWCQ014:'',
            GWCS014:'',
            GWCU009:'',
            GWCV006:'',
            score:''
        };

        mui.ready(function () {
            self.getYsh();
            new Vue({
                el: doc.getElementById('content'),
                data: {
                    item: infoItem
                },
                methods:{
                    sum:function (item) {
                        var count = 0
                        for(var i =0;i<item.length;i++){
                            count = count + item[i].GWCM005;
                        }
                        return count;
                    },
                }
            });

            new Vue({
                el: doc.getElementById('jd'),
                data: {
                    jditem: infoItem.orderList
                },
                methods: {
                    shenhe: function (value) {
                        if (value) {
                            return "已审核";
                        } else {
                            return "";
                        }
                    },
                    gouwu: function (value) {
                        if (value) {
                            return "已购物";
                        } else {
                            return "";
                        }
                    },
                    xiadan: function (value) {
                        if (value) {
                            return "已下单";
                        } else {
                            return "";
                        }
                    },
                    fayun: function (value) {
                        if (value) {
                            return "已发运";
                        } else {
                            return "";
                        }
                    },
                    anzhuang: function (value) {
                        if (value) {
                            return "已安装";
                        } else {
                            return "";
                        }
                    },
                    pingjia: function (value) {
                        if (value) {
                            return "已评价";
                        } else {
                            return "";
                        }
                    }
                }
            });


        });
    }


    return new xdcxinfo();

});